<?php

namespace App\Services;

use App\Common\Services\BaseService;
use App\Sdks\Ali\Ali;

class AliService extends BaseService
{
    protected $sdk;

    /**
     * constructor.
     */
    public function __construct(){
        parent::__construct();

        $this->sdk = new Ali(env('ALI_ACCESS_KEY_ID'), env('ALI_ACCESS_KEY_SECRET'));
    }

    /**
     * @param $phone
     * @param $captcha
     * @return mixed
     * 发送短信验证码
     */
    public function sendSmsCaptcha($phone, $captcha){
        return $this->sdk->sendSms(
            $phone,
            env('ALI_SMS_SIGN_NAME'),
            'SMS_203030186',
            '{"code": "'. $captcha .'"}'
        );
    }
}
